<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods', function (Blueprint $table) {
            $table->increments('id');
            $table->string('type');//商品类别 ->比如自营,淘宝,天猫
            $table->string('title',120);//商品标题
            $table->string('sn',60)->nullable();//商品编号
            $table->string('lable',255)->nullable();//商品标注
            $table->string('tags',255)->nullable();//商品标签
            $table->json('picture')->nullable();//首图
            $table->json('slider')->nullable();//轮播
            $table->string('keywords',60)->nullable();//关键词
            $table->text('description')->nullable();//描述
            $table->text('particulars')->nullable();//详情
            $table->string('origin',60);//发货地
            $table->json('specification')->nullable();//规格
            $table->string('url',300)->nullable();//URL
            $table->string('taobao_sn',60)->nullable();//淘宝商品号
            $table->decimal('prime_cost',10,2);//商品原价
            $table->decimal('suggest_cost',10,2);//商品建议价格
            $table->integer('sort')->default(99);//商品排序
            $table->integer('created_id');//创建人
            $table->integer('shop_id');//所属店铺
            $table->integer('category_id');//所属分类
            $table->integer('collect');//收藏数量
            $table->string('payment_mode',255);//支付方式
            $table->string('promise_mode',255);//承诺方式
            $table->boolean('post_free')->default(false);//是否包邮
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('goods');
    }
}
